﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Common;

namespace Ex01
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] names = { "Tom", "Dick", "Harry", "Mary", "Jay" };
            IEnumerable<string> query1 = names
                .Where(n => n.Contains("a"))
                .OrderBy(n => n.Length)
                .Select(n => n.ToUpper());

            IEnumerable<string> query =
              Enumerable.Select(
                Enumerable.OrderBy(
                  Enumerable.Where(
                    names, n => n.Contains("a")
                  ), n => n.Length
                ), n => n.ToUpper()
              );

            //query.Dump("The correct result, but an untidy query!");
            //query1.Dump("query1");
            Console.ReadKey();
        }
    }

}
